<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:controls="using:WinRTXamlToolkit.Controls">
    <FontFamily
        x:Key="SymbolThemeFontFamily">Segoe UI Symbol</FontFamily>
    
    <!-- WatermarkPasswordBox default style -->
    <Style
        TargetType="controls:WatermarkPasswordBox">
        <Setter
            Property="MinWidth"
            Value="{StaticResource TextControlThemeMinWidth}" />
        <Setter
            Property="MinHeight"
            Value="{StaticResource TextControlThemeMinHeight}" />
        <Setter
            Property="Foreground"
            Value="{StaticResource TextBoxForegroundThemeBrush}" />
        <Setter
            Property="Background"
            Value="{StaticResource TextBoxBackgroundThemeBrush}" />
        <Setter
            Property="BorderBrush"
            Value="{StaticResource TextBoxBorderThemeBrush}" />
        <Setter
            Property="BorderThickness"
            Value="{StaticResource TextControlBorderThemeThickness}" />
        <Setter
            Property="FontFamily"
            Value="{StaticResource ContentControlThemeFontFamily}" />
        <Setter
            Property="FontSize"
            Value="{StaticResource ControlContentThemeFontSize}" />
        <Setter
            Property="ScrollViewer.HorizontalScrollBarVisibility"
            Value="Hidden" />
        <Setter
            Property="ScrollViewer.VerticalScrollBarVisibility"
            Value="Hidden" />
        <Setter
            Property="Padding"
            Value="{StaticResource TextControlThemePadding}" />
        <Setter
            Property="WatermarkTextStyle">
            <Setter.Value>
                <Style
                    TargetType="TextBlock">
                    <Setter
                        Property="Margin"
                        Value="{StaticResource TextControlBorderThemeThickness}" />
                    <Setter
                        Property="Padding"
                        Value="{StaticResource TextControlThemePadding}" />
                    <Setter
                        Property="FontFamily"
                        Value="{StaticResource ContentControlThemeFontFamily}" />
                    <Setter
                        Property="FontSize"
                        Value="{StaticResource ControlContentThemeFontSize}" />
                    <Setter
                        Property="Foreground"
                        Value="{StaticResource TextBoxDisabledForegroundThemeBrush}" />
                    <Setter
                        Property="FontWeight"
                        Value="SemiBold" />
                </Style>
            </Setter.Value>
        </Setter>
        <Setter
            Property="Template">
            <Setter.Value>
                <ControlTemplate
                    TargetType="controls:WatermarkPasswordBox">
                    <PasswordBox
                        x:Name="PART_PasswordBox"
                        CharacterSpacing="{TemplateBinding CharacterSpacing}"
                        MinWidth="{TemplateBinding MinWidth}"
                        MinHeight="{TemplateBinding MinHeight}"
                        Foreground="{TemplateBinding Foreground}"
                        Background="{TemplateBinding Background}"
                        BorderBrush="{TemplateBinding BorderBrush}"
                        BorderThickness="{TemplateBinding BorderThickness}"
                        FontFamily="{TemplateBinding FontFamily}"
                        FontSize="{TemplateBinding FontSize}"
                        Padding="{TemplateBinding Padding}"
                        HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
                        VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
                        ScrollViewer.HorizontalScrollMode="{TemplateBinding ScrollViewer.HorizontalScrollMode}"
                        ScrollViewer.HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}"
                        ScrollViewer.IsHorizontalRailEnabled="{TemplateBinding ScrollViewer.IsHorizontalRailEnabled}"
                        ScrollViewer.VerticalScrollMode="{TemplateBinding ScrollViewer.VerticalScrollMode}"
                        ScrollViewer.VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}"
                        ScrollViewer.IsVerticalRailEnabled="{TemplateBinding ScrollViewer.IsVerticalRailEnabled}"
                        controls:WatermarkPasswordBox.Watermark="{TemplateBinding controls:WatermarkPasswordBox.Watermark}"
                        controls:WatermarkPasswordBox.WatermarkText="{TemplateBinding controls:WatermarkPasswordBox.WatermarkText}"
                        controls:WatermarkPasswordBox.WatermarkTextStyleRelay="{TemplateBinding WatermarkTextStyle}">
                        <PasswordBox.Template>
                            <ControlTemplate
                                TargetType="PasswordBox">
                                <Grid>
                                    <Grid.Resources>
                                        <Style
                                            x:Name="RevealButtonStyle"
                                            TargetType="Button">
                                            <Setter
                                                Property="Template">
                                                <Setter.Value>
                                                    <ControlTemplate
                                                        TargetType="Button">
                                                        <Grid>
                                                            <VisualStateManager.VisualStateGroups>
                                                                <VisualStateGroup
                                                                    x:Name="CommonStates">
                                                                    <VisualState
                                                                        x:Name="Normal" />
                                                                    <VisualState
                                                                        x:Name="PointerOver">
                                                                        <Storyboard>
                                                                            <ObjectAnimationUsingKeyFrames
                                                                                Storyboard.TargetProperty="Background"
                                                                                Storyboard.TargetName="BackgroundElement">
                                                                                <DiscreteObjectKeyFrame
                                                                                    KeyTime="0"
                                                                                    Value="{StaticResource TextBoxButtonPointerOverBackgroundThemeBrush}" />
                                                                            </ObjectAnimationUsingKeyFrames>
                                                                            <ObjectAnimationUsingKeyFrames
                                                                                Storyboard.TargetProperty="BorderBrush"
                                                                                Storyboard.TargetName="BorderElement">
                                                                                <DiscreteObjectKeyFrame
                                                                                    KeyTime="0"
                                                                                    Value="{StaticResource TextBoxButtonPointerOverBorderThemeBrush}" />
                                                                            </ObjectAnimationUsingKeyFrames>
                                                                            <ObjectAnimationUsingKeyFrames
                                                                                Storyboard.TargetProperty="Foreground"
                                                                                Storyboard.TargetName="GlyphElement">
                                                                                <DiscreteObjectKeyFrame
                                                                                    KeyTime="0"
                                                                                    Value="{StaticResource TextBoxButtonPointerOverForegroundThemeBrush}" />
                                                                            </ObjectAnimationUsingKeyFrames>
                                                                        </Storyboard>
                                                                    </VisualState>
                                                                    <VisualState
                                                                        x:Name="Pressed">
                                                                        <Storyboard>
                                                                            <ObjectAnimationUsingKeyFrames
                                                                                Storyboard.TargetProperty="Background"
                                                                                Storyboard.TargetName="BackgroundElement">
                                                                                <DiscreteObjectKeyFrame
                                                                                    KeyTime="0"
                                                                                    Value="{StaticResource TextBoxButtonPressedBackgroundThemeBrush}" />
                                                                            </ObjectAnimationUsingKeyFrames>
                                                                            <ObjectAnimationUsingKeyFrames
                                                                                Storyboard.TargetProperty="BorderBrush"
                                                                                Storyboard.TargetName="BorderElement">
                                                                                <DiscreteObjectKeyFrame
                                                                                    KeyTime="0"
                                                                                    Value="{StaticResource TextBoxButtonPressedBorderThemeBrush}" />
                                                                            </ObjectAnimationUsingKeyFrames>
                                                                            <ObjectAnimationUsingKeyFrames
                                                                                Storyboard.TargetProperty="Foreground"
                                                                                Storyboard.TargetName="GlyphElement">
                                                                                <DiscreteObjectKeyFrame
                                                                                    KeyTime="0"
                                                                                    Value="{StaticResource TextBoxButtonPressedForegroundThemeBrush}" />
                                                                            </ObjectAnimationUsingKeyFrames>
                                                                        </Storyboard>
                                                                    </VisualState>
                                                                    <VisualState
                                                                        x:Name="Disabled">
                                                                        <Storyboard>
                                                                            <DoubleAnimation
                                                                                Duration="0"
                                                                                To="0"
                                                                                Storyboard.TargetProperty="Opacity"
                                                                                Storyboard.TargetName="BackgroundElement" />
                                                                            <DoubleAnimation
                                                                                Duration="0"
                                                                                To="0"
                                                                                Storyboard.TargetProperty="Opacity"
                                                                                Storyboard.TargetName="BorderElement" />
                                                                        </Storyboard>
                                                                    </VisualState>
                                                                </VisualStateGroup>
                                                            </VisualStateManager.VisualStateGroups>
                                                            <Border
                                                                x:Name="BorderElement"
                                                                BorderBrush="{StaticResource TextBoxButtonBorderThemeBrush}"
                                                                BorderThickness="{TemplateBinding BorderThickness}" />
                                                            <Border
                                                                x:Name="BackgroundElement"
                                                                Background="{StaticResource TextBoxButtonBackgroundThemeBrush}"
                                                                Margin="{TemplateBinding BorderThickness}">
                                                                <TextBlock
                                                                    x:Name="GlyphElement"
                                                                    Foreground="{StaticResource TextBoxButtonForegroundThemeBrush}"
                                                                    FontFamily="{StaticResource SymbolThemeFontFamily}"
                                                                    HorizontalAlignment="Center"
                                                                    Text="&#xE052;"
                                                                    VerticalAlignment="Center" />
                                                            </Border>
                                                        </Grid>
                                                    </ControlTemplate>
                                                </Setter.Value>
                                            </Setter>
                                        </Style>
                                    </Grid.Resources>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition
                                            Width="*" />
                                        <ColumnDefinition
                                            Width="Auto" />
                                    </Grid.ColumnDefinitions>
                                    <VisualStateManager.VisualStateGroups>
                                        <VisualStateGroup
                                            x:Name="CommonStates">
                                            <VisualState
                                                x:Name="Disabled">
                                                <Storyboard>
                                                    <ObjectAnimationUsingKeyFrames
                                                        Storyboard.TargetProperty="Background"
                                                        Storyboard.TargetName="BackgroundElement">
                                                        <DiscreteObjectKeyFrame
                                                            KeyTime="0"
                                                            Value="{StaticResource TextBoxDisabledBackgroundThemeBrush}" />
                                                    </ObjectAnimationUsingKeyFrames>
                                                    <ObjectAnimationUsingKeyFrames
                                                        Storyboard.TargetProperty="BorderBrush"
                                                        Storyboard.TargetName="BorderElement">
                                                        <DiscreteObjectKeyFrame
                                                            KeyTime="0"
                                                            Value="{StaticResource TextBoxDisabledBorderThemeBrush}" />
                                                    </ObjectAnimationUsingKeyFrames>
                                                    <ObjectAnimationUsingKeyFrames
                                                        Storyboard.TargetProperty="Foreground"
                                                        Storyboard.TargetName="ContentElement">
                                                        <DiscreteObjectKeyFrame
                                                            KeyTime="0"
                                                            Value="{StaticResource TextBoxDisabledForegroundThemeBrush}" />
                                                    </ObjectAnimationUsingKeyFrames>
                                                </Storyboard>
                                            </VisualState>
                                            <VisualState
                                                x:Name="Normal">
                                                <Storyboard>
                                                    <DoubleAnimation
                                                        Duration="0"
                                                        To="{StaticResource TextControlBackgroundThemeOpacity}"
                                                        Storyboard.TargetProperty="Opacity"
                                                        Storyboard.TargetName="BackgroundElement" />
                                                    <DoubleAnimation
                                                        Duration="0"
                                                        To="{StaticResource TextControlBorderThemeOpacity}"
                                                        Storyboard.TargetProperty="Opacity"
                                                        Storyboard.TargetName="BorderElement" />
                                                </Storyboard>
                                            </VisualState>
                                            <VisualState
                                                x:Name="PointerOver">
                                                <Storyboard>
                                                    <DoubleAnimation
                                                        Duration="0"
                                                        To="{StaticResource TextControlPointerOverBackgroundThemeOpacity}"
                                                        Storyboard.TargetProperty="Opacity"
                                                        Storyboard.TargetName="BackgroundElement" />
                                                    <DoubleAnimation
                                                        Duration="0"
                                                        To="{StaticResource TextControlPointerOverBorderThemeOpacity}"
                                                        Storyboard.TargetProperty="Opacity"
                                                        Storyboard.TargetName="BorderElement" />
                                                </Storyboard>
                                            </VisualState>
                                            <VisualState
                                                x:Name="Focused" />
                                        </VisualStateGroup>
                                        <VisualStateGroup
                                            x:Name="ButtonStates">
                                            <VisualState
                                                x:Name="ButtonVisible">
                                                <Storyboard>
                                                    <ObjectAnimationUsingKeyFrames
                                                        Storyboard.TargetProperty="Visibility"
                                                        Storyboard.TargetName="RevealButton">
                                                        <DiscreteObjectKeyFrame
                                                            KeyTime="0">
                                                            <DiscreteObjectKeyFrame.Value>
                                                                <Visibility>Visible</Visibility>
                                                            </DiscreteObjectKeyFrame.Value>
                                                        </DiscreteObjectKeyFrame>
                                                    </ObjectAnimationUsingKeyFrames>
                                                </Storyboard>
                                            </VisualState>
                                            <VisualState
                                                x:Name="ButtonCollapsed" />
                                        </VisualStateGroup>
                                        <VisualStateGroup
                                            x:Name="WatermarkStates">
                                            <VisualState
                                                x:Name="WatermarkVisible">
                                                <Storyboard>
                                                    <ObjectAnimationUsingKeyFrames
                                                        Storyboard.TargetProperty="Visibility"
                                                        Storyboard.TargetName="WatermarkTextBlock">
                                                        <DiscreteObjectKeyFrame
                                                            KeyTime="0">
                                                            <DiscreteObjectKeyFrame.Value>
                                                                <Visibility>Visible</Visibility>
                                                            </DiscreteObjectKeyFrame.Value>
                                                        </DiscreteObjectKeyFrame>
                                                    </ObjectAnimationUsingKeyFrames>
                                                    <ObjectAnimationUsingKeyFrames
                                                        Storyboard.TargetProperty="Visibility"
                                                        Storyboard.TargetName="WatermarkPresenter">
                                                        <DiscreteObjectKeyFrame
                                                            KeyTime="0">
                                                            <DiscreteObjectKeyFrame.Value>
                                                                <Visibility>Visible</Visibility>
                                                            </DiscreteObjectKeyFrame.Value>
                                                        </DiscreteObjectKeyFrame>
                                                    </ObjectAnimationUsingKeyFrames>
                                                </Storyboard>
                                            </VisualState>
                                            <VisualState
                                                x:Name="WatermarkHidden" />
                                        </VisualStateGroup>
                                    </VisualStateManager.VisualStateGroups>
                                    <Border
                                        x:Name="BackgroundElement"
                                        Background="{TemplateBinding Background}"
                                        Grid.ColumnSpan="2"
                                        Margin="{TemplateBinding BorderThickness}" />
                                    <Border
                                        x:Name="BorderElement"
                                        BorderBrush="{TemplateBinding BorderBrush}"
                                        BorderThickness="{TemplateBinding BorderThickness}"
                                        Grid.ColumnSpan="2" />
                                    <ScrollViewer
                                        x:Name="ContentElement"
                                        HorizontalScrollMode="{TemplateBinding ScrollViewer.HorizontalScrollMode}"
                                        HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}"
                                        IsTabStop="False"
                                        IsHorizontalRailEnabled="{TemplateBinding ScrollViewer.IsHorizontalRailEnabled}"
                                        IsVerticalRailEnabled="{TemplateBinding ScrollViewer.IsVerticalRailEnabled}"
                                        Margin="{TemplateBinding BorderThickness}"
                                        Padding="{TemplateBinding Padding}"
                                        VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}"
                                        VerticalScrollMode="{TemplateBinding ScrollViewer.VerticalScrollMode}"
                                        ZoomMode="Disabled" />
                                    <TextBlock
                                        x:Name="WatermarkTextBlock"
                                        Style="{TemplateBinding controls:WatermarkPasswordBox.WatermarkTextStyleRelay}"
                                        Text="{TemplateBinding controls:WatermarkPasswordBox.WatermarkText}"
                                        IsHitTestVisible="False"
                                        Visibility="Collapsed" />
                                    <ContentPresenter
                                        x:Name="WatermarkPresenter"
                                        HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                        VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                        Content="{TemplateBinding controls:WatermarkPasswordBox.Watermark}"
                                        Margin="{TemplateBinding Padding}"
                                        FontFamily="{TemplateBinding FontFamily}"
                                        FontSize="{TemplateBinding FontSize}"
                                        Foreground="{TemplateBinding Foreground}"
                                        Visibility="Collapsed" />
                                    <Button
                                        x:Name="RevealButton"
                                        BorderThickness="{TemplateBinding BorderThickness}"
                                        Grid.Column="1"
                                        FontSize="{TemplateBinding FontSize}"
                                        IsTabStop="False"
                                        Style="{StaticResource RevealButtonStyle}"
                                        Visibility="Collapsed"
                                        VerticalAlignment="Stretch" />
                                </Grid>
                            </ControlTemplate>
                        </PasswordBox.Template>
                    </PasswordBox>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>
